use notepad_derive::Db;
use serde::{Deserialize, Serialize};

#[derive(Debug, Default, Deserialize, Serialize, Clone, sqlx::FromRow, Db)]
#[db(table = "notes", pk = "id")]
pub struct Note {
    #[db(find)]
    #[db(skip_update)]
    pub id: String,

    #[db(list_opt)]
    #[db(opt_like)]
    /// 内容
    pub content: String,

    /// 是否MARKDOWN
    pub is_md: bool,

    /// 是否有访问密码
    pub has_view_pwd: bool,

    /// 访问密码
    pub view_pwd: String,

    /// 是否有管理密码
    pub has_man_pwd: bool,

    /// 管理密码
    pub man_pwd: String,

    /// 是否已归档
    pub is_arch: bool,

    /// 发布时间
    #[db(skip_update)]
    pub dateline: chrono::DateTime<chrono::Local>,
}
